<template>
  <div>
    <input v-model="value" type="text" />
    <button @click="add">add</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: ''
    };
  },
  methods: {
    add() {
      if (!this.value) return;
      const currentTodo = {
        name: this.value
      };
      this.$emit('add', currentTodo);
      this.value = '';
    }
  }
};
</script>

<style scope>
</style>